package cn.demoncat.util.io.entity;

import java.io.InputStream;
import java.util.List;
import java.util.Objects;

/**
 * 描述：输入流文件
 *
 * @author 延晓磊
 *
 * @since 2017年5月21日
 */
public final class InsFile{
 
	//文件名
	private String fileName;
	//文件全路径名
	private String filePath;
	//是否为目录
	private boolean isDir;
	//文件的输入流
	private InputStream ins;
	//目录文件的子文件
	private List<InsFile> children;
	
 
	public InsFile() {
		super();
	}


	public InsFile(String fileName, String filePath, boolean isDir, InputStream ins, List<InsFile> children) {
		super();
		this.fileName = fileName;
		this.filePath = filePath;
		this.isDir = isDir;
		this.ins = ins;
		this.children = children;
	}

	public String getFileName() {
		return fileName;
	}


	public void setFileName(String fileName) {
		this.fileName = fileName;
	}


	public String getFilePath() {
		return filePath;
	}


	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}


	public boolean isDir() {
		return isDir;
	}


	public void setDir(boolean isDir) {
		this.isDir = isDir;
	}


	public InputStream getIns() {
		return ins;
	}


	public void setIns(InputStream ins) {
		this.ins = ins;
	}


	public List<InsFile> getChildren() {
		return children;
	}


	public void setChildren(List<InsFile> children) {
		this.children = children;
	}

	@Override
	public String toString() {
		return "InsFile{" +
				"fileName='" + fileName + '\'' +
				", filePath='" + filePath + '\'' +
				", isDir=" + isDir +
				", ins=" + ins +
				", children=" + children +
				'}';
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		InsFile insFile = (InsFile) o;
		return isDir == insFile.isDir &&
				Objects.equals(fileName, insFile.fileName) &&
				Objects.equals(filePath, insFile.filePath) &&
				Objects.equals(ins, insFile.ins) &&
				Objects.equals(children, insFile.children);
	}

	@Override
	public int hashCode() {
		return Objects.hash(fileName, filePath, isDir, ins, children);
	}
}
